package com.onesports.intelligent.k12.polarlight.annotation;

import com.onesports.intelligent.k12.polarlight.enums.DataPermissionJoinTypeEnum;
import com.onesports.intelligent.k12.polarlight.enums.DataPermissionTypeEnum;
import org.springframework.core.annotation.AliasFor;

import java.lang.annotation.*;

/**
 * 数据权限
 *
 * @author aj
 */
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD})
public @interface DataPermission {
    /**
     * 权限类型,
     * 默认运营端按机构，机构端按校区
     */
    DataPermissionTypeEnum value() default DataPermissionTypeEnum.DEFAULT;

    /**
     * 目标表名
     *
     * @return
     */
    String tableName() default "";

    /**
     * 目标(表)别名
     *
     * @return
     */
    String alias() default "";

    /**
     * 权限关联类型
     * 为outer join时tableName或alias必有一个不为空
     *
     * @return
     */
    DataPermissionJoinTypeEnum joinType() default DataPermissionJoinTypeEnum.
            INNER_JOIN;


}


